<?php 
header("content-type:text/html;charset=utf8");
$id = $_GET['id'];
$redis = new Redis();$redis->connect('127.0.0.1','6379');
$pdo = new PDO("mysql:host=127.0.0.1;dbname=liu;charset=utf8",'root','root');
$data = $pdo->query("select * from goods where id=$id")->fetch();
if ($redis->get('visit'.$id)) {
	$redis->incr('visit'.$id);
	$visit = $redis->get('visit'.$id);
}
else
{
	$redis->set('visit'.$id,1);
    $visit=1;
}


 ?>
 <!doctype html>
 <html lang="en">
 <head>
 	<meta charset="UTF-8">
 	<title>Document</title>
 </head>
 <body>
 	<center>
 		<h1>详情页</h1>
 		<span>这是您第<?php echo $visit; ?>次访问</span>
 		<table>
 			<tr>
 				<th>商品名</th>
 				<th>商品分类</th>
 				<th>品牌</th>
 				<th>价格</th>
 				<th>库存</th>
 				<th>操作</th>

 			</tr>
 			
 			   <tr>
 			   	  <td><?php echo $data['goods_name'] ?></td>
 			   	  <td><?php echo $data['goods_class'] ?></td>
 			   	  <td><?php echo $data['goods_grand'] ?></td>
 			   	  <td><?php echo $data['goods_price'] ?></td>
 			   	  <td><?php echo $data['goods_stock'] ?></td>
 			   </tr>
 			
 		</table>
 	
 	</center>
 </body>
 </html>